#!/usr/bin/perl
# usage:
# cd ./scripts 
# select_all_from 
# - will print schema of ALL tables in database $db

# cd ./scripts 
# select_all_from table_name1 table_name2


$sqlite = "sqlite3";
$db = "../db_sqlite.db";

print $tables = `$sqlite $db ".tables"`;
print "\n";
@tables = split /\s+/, $tables;
if ( $ARGV[0] ){ @tables = ( @ARGV) }

for ( @tables ){
 print $schema = `$sqlite $db  "SELECT * FROM $_"`;
 print "\n";
}

